home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
VerticalHold.sit
/
Vertical Hold
/
source code
/
PixelatorPlug.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-06-27
|
2KB
|
90 lines
#include <LowMem.h>
#include <A4Stuff.h>
#include <QuickDraw.h>
#include <Memory.h>
#include <Resources.h>
#include <Fonts.h>
#include <Dialogs.h>
#include <QDOffscreen.h>
#include <string.h>
#include <stdio.h>
#include <Timer.h>
int pixelatorPos = 1;
static Boolean growing = true;
int pixelatorVal[100] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21, -15, 17, 18, -12, -16, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21, -15, 17, 18, -12, -16, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -16, -12, 18, 17, -15, 21,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
void initPixelatorPlug()
{
}
void disposePixelatorPlug()
{
}
typedef struct {
TMTask task;
Ptr mainBaseAddr;
Size worldBytes;
Ptr worldBuffer;
short rowBytes;
short phase;
Rect size;
short offset;
} MyTaskRec;
void doPixelatorPlug(MyTaskRec* myTask)
{
EnterCodeResource ();
short height = myTask -> size.bottom - myTask -> size.top;
short phase = myTask -> phase;
short rowBytes = myTask -> rowBytes;
Ptr worldBuffer = myTask -> worldBuffer;
Ptr screenBuffer = myTask -> mainBaseAddr;
pixelatorPos+= growing ? 1 : -1;
if(pixelatorPos > 5)
{
pixelatorPos = 5;
growing = false;
}
if(pixelatorPos < 1)
{
pixelatorPos = 1;
growing = true;
}
int i;
for(i = 0; i < height; i++)
{
char *j;
char *k;
k = screenBuffer + i * rowBytes;
for(j = worldBuffer + i * rowBytes; j <= worldBuffer + i * rowBytes + rowBytes - 1 ; j+=pixelatorPos)
{
long l;
for(l = 0; l < pixelatorPos && (j+l <= worldBuffer + i * rowBytes + rowBytes - 1); l++)
{
*k = *j;
k++;
}
}
}
ExitCodeResource ();
}